﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Web.UI.WebControls;
using System.Web.UI;

using WebSite.Domain;

namespace WebSite.DAL {
    public class ItemProntuarioPorProntuarioDAO 
    {
        public static void CadastrarItensProntuarioPorProntuario(ItemProntuario itemProntuario)
        {            
            string strsql = "INSERT INTO tab_ItemProntuarioPorProntuario(idProntuario, idItemProntuario) values((select IDENT_CURRENT('SistemaProntuario.dbo.tab_Prontuario')),@idItemProntuario)";
            SqlConnection objConnection = ConnectionFactory.obterConexao();
            objConnection.Open();
            SqlCommand objCommand = new SqlCommand(strsql, objConnection);
            objCommand.Parameters.Add(new SqlParameter("@idItemProntuario", itemProntuario.idItemProntuario));

            objCommand.ExecuteNonQuery();
            objConnection.Close();            
        }

    }
}